package com.zeus.base.smscenter.controller;

import com.zeus.base.privilege.model.TbUser;
import com.zeus.base.privilege.service.IUserService;
import com.zeus.base.smscenter.common.BaseController;
import com.zeus.base.smscenter.utils.SessionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;


/**
 * 用户管理Controller
 *
 * @author sf
 * @version 2017-03-08
 */
@SuppressWarnings("ALL")
@RestController
@RequestMapping("/controller/user")
public class UserController extends BaseController {
    @Autowired
    IUserService iUserService;

    /**
     * 获取当前登录用户
     * @return
     */
    @RequestMapping(value = "/getLoginUser", method = RequestMethod.POST)
    @ResponseBody
    public TbUser getLoginUser(HttpServletRequest request){
        TbUser loginUser = SessionUtil.getSessionUser(request);
        if(loginUser != null) loginUser.setCurrentProductLine(getConfigUtil().getProductLineCode());
        return loginUser;
    }

}
